package com.wwdx.service.impl;

import com.google.common.collect.Maps;
import com.wwdx.model.WwdxOpenAuthModel;
import com.wwdx.service.WwdxOpenAuthServiceI;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * @author liguoliang
 * @date 2018/9/20 11:38
 */
@Service
public class WwdxOpenAuthServiceImpl extends BaseServiceImpl<WwdxOpenAuthModel> implements WwdxOpenAuthServiceI{

    @Override
    public WwdxOpenAuthModel getByOpenIdAndStatus(String openId, Integer status) {
        HashMap<String, Object> params = Maps.newHashMapWithExpectedSize(2);
        params.put("openId",openId);
        params.put("status",status);
        return getByHql("from WwdxOpenAuthModel where openId=:openId and status=:status",params);
    }

    @Override
    public WwdxOpenAuthModel getByAppId(String appId) {
        HashMap<String, Object> params = Maps.newHashMapWithExpectedSize(2);
        params.put("appId",appId);
        return getByHql("from WwdxOpenAuthModel where authorizerAppid=:appId",params);
    }
}